// myviews/questions/questions.js
var globalData = getApp().globalData;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    question:"",
    backList:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var userInfo = globalData.backUserInfo;
    //保存
    var _this = this;
    var url = getApp().globalData.apiDomain + "/FeedBack?userid=" + userInfo.syS0100;
    wx.request({
      url: url,
      method: "GET",
      success: function (res) {
        if (res.data.code == 200) {
          _this.setData({
            backList: res.data.data
          })
        //console.log(_this.data.backList);
        }
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },
  questionInput:function(e){
    this.setData({
      question:e.detail.value
    })
  },
  //提交反馈
  submit:function(){
    var userInfo = globalData.backUserInfo;
    console.log(userInfo);
    var postData = {
      userId: userInfo.syS0100,
      userName:"",
      content:this.data.question
    };
    //保存
    var _this = this;
    var url = getApp().globalData.apiDomain + "/FeedBack";
    wx.request({
      url: url,
      method: "POST",
      data:postData,
      success: function (res) {
        if(res.data.code == 200 ){
          wx.showModal({
            title: '提示',
            content: '反馈成功',
            showCancel:false,
            success:function(){

            }
          })
        }
      }
    })
  }
})